package org.railage.server.services;

import java.util.List;

import org.railage.common.dto.ScheduleRecordDTO;
import org.railage.server.dao.ScheduleRecordDAO;
import org.railage.server.dao.ScheduleRecordDAOImpl;
import org.railage.server.entities.ScheduleRecord;

public class ScheduleService {

	private ScheduleRecordDAO scheduleRecordDAO = new ScheduleRecordDAOImpl();

	public ScheduleRecordDTO[] getSchedule(Object obj) {
		List<ScheduleRecord> schedule = scheduleRecordDAO
				.getSchedule((String) obj);
		ScheduleRecordDTO[] scheduleDTO = new ScheduleRecordDTO[schedule.size()];
		int i = 0;
		for (ScheduleRecord record : schedule) {
			scheduleDTO[i] = record.toDTO();
			i++;
		}
		return scheduleDTO;
	}
}
